<?php

namespace App\Http\Requests\Home;

use Illuminate\Foundation\Http\FormRequest;

class UserPhoneResetPwd extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'phone'     =>[
                            'required',
                            'regex:/^1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9])\\d{8}$/',
            ],
            'phonecode' => 'required',
            'code'      => 'required',
        ];

    }

    public function messages()
    {
         return [
            'phone.required'     => '请输入手机号码',
            'phone.regex'        => '手机号不合法',

            'phonecode.required' => '请输入手机验证码',

            'code.required'      => '请输入验证码',
        ];
    }
}
